from django.contrib.auth.mixins import LoginRequiredMixin
from django import http


class LoginRequiredJSONMixin(LoginRequiredMixin):
    """自定义LoginRequiredMixin"""
    """如果用户未登录,响应JSON,且状态码为"""

    def handle_no_permission(self):
        return http.JsonResponse({'errno': 400, "errmsg": '登陆失败'})